package com.hntech.base.thread;

public class VolatileCaseWork extends Thread {

    private volatile static Boolean flag = false;   //从主内存读取数据

    public void run() {
        while (!flag) {

        }
    }

    public static void main(String[] args) throws InterruptedException {
        VolatileCaseWork vCase = new VolatileCaseWork();
        vCase.start();
        Thread.sleep(100);
        flag = true;
    }

}
